//--------------------------------------------------------------------------------------------------------------------
// register the function
 var newRegistery1 = new Array("getRankingTableData", "drawRankingTable" );
 allJsonsRegistry = allJsonsRegistry.concat(newRegistery1);

//--------------------------------------------------------------------------------------------------------------------
// implement the function
// this table  display the rank of the player according to the number of assets. In column, we have the asset and in lines
// the ranked player in the order they would have if the asset in the column header were the first to strike
function drawRankingTable(rankingTableData) 
{
	var data = new google.visualization.DataTable();
	var nbPlayers = rankingTableData.playerList.length
	data.addColumn('string', "Player");
	data.addColumn('number', "MtM");
	data.addColumn('number', "Rank");
	
	data.addRows(nbPlayers);
	for (var p = 0; p < nbPlayers; p++)
	{
	    data.setCell(p, 0, rankingTableData.playerList[p].name );
	    data.setCell(p, 1, Math.round( 100* rankingTableData.playerList[p].mtm) / 100 );
	    data.setCell(p, 2, p + 1 );
	    
	}
	var table = new google.visualization.Table(document.getElementById('rankingTable_div'));	
	table.draw(data, {title: 'Current rank'});
}

